package com.ruoyi.project.repertory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.repertory.mapper.GoodsRepertoryMapper;
import com.ruoyi.project.repertory.domain.GoodsRepertory;
import com.ruoyi.project.repertory.service.IGoodsRepertoryService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 库存Service业务层处理
 * 
 * @author lonsn
 * @date 2020-11-06
 */
@Service
public class GoodsRepertoryServiceImpl implements IGoodsRepertoryService 
{
    @Autowired
    private GoodsRepertoryMapper goodsRepertoryMapper;

    /**
     * 查询库存
     * 
     * @param id 库存ID
     * @return 库存
     */
    @Override
    public GoodsRepertory selectGoodsRepertoryById(Integer id)
    {
        return goodsRepertoryMapper.selectGoodsRepertoryById(id);
    }

    /**
     * 查询库存
     *
     * @param deptId 部门ID
     * @return 库存
     */
    @Override
    public GoodsRepertory selectGoodsRepertory(Integer deptId,String styleNumber) {
        return goodsRepertoryMapper.selectGoodsRepertory(deptId,styleNumber);
    }

    /**
     * 查询库存列表
     * 
     * @param goodsRepertory 库存
     * @return 库存
     */
    @Override
    public List<GoodsRepertory> selectGoodsRepertoryList(GoodsRepertory goodsRepertory)
    {
        return goodsRepertoryMapper.selectGoodsRepertoryList(goodsRepertory);
    }

    /**
     * 新增库存
     * 
     * @param goodsRepertory 库存
     * @return 结果
     */
    @Override
    public int insertGoodsRepertory(GoodsRepertory goodsRepertory)
    {
        goodsRepertory.setCreateTime(DateUtils.getNowDate());
        return goodsRepertoryMapper.insertGoodsRepertory(goodsRepertory);
    }

    /**
     * 修改库存
     * 
     * @param goodsRepertory 库存
     * @return 结果
     */
    @Override
    public int updateGoodsRepertory(GoodsRepertory goodsRepertory)
    {
        return goodsRepertoryMapper.updateGoodsRepertory(goodsRepertory);
    }

    /**
     * 删除库存对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteGoodsRepertoryByIds(String ids)
    {
        return goodsRepertoryMapper.deleteGoodsRepertoryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除库存信息
     * 
     * @param id 库存ID
     * @return 结果
     */
    @Override
    public int deleteGoodsRepertoryById(Integer id)
    {
        return goodsRepertoryMapper.deleteGoodsRepertoryById(id);
    }
}
